package game.resource.loader.tagparser;

import org.xml.sax.Attributes;

import common.Coordinate;
import common.Log;

public class OffsetTagParser implements TagParser_I {
	public Coordinate Offset;
	
	@Override
	public boolean parse(String tag, Attributes attributes) {
		if(!tag.toLowerCase().equals("offset")) {
			return false;
		}

		int x, y;
		try {
			x = Integer.parseInt(attributes.getValue("x"));
			y = Integer.parseInt(attributes.getValue("y"));
		} catch (NumberFormatException e) {
			Log.warning("Bad format of offset string.");
			return false;
		}
		Offset = new Coordinate(x, y);
		return true;
	}
}
